import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
			type:1,
			content:'请在信息模块中获取数据哟',
			title:'',
			sid:'',
			login:false,
			token:null
  },
  getters:{
  	gettype(state){
  		return state.type;
  	},
  	getcontent(state){
  		return state.content
  	},
  	gettitle(state){
  		return state.title
  	},
  	getid(state){
  		return state.sid
  	},
  	getlogin(state){
  		return state.login
  	},
  	gettoken(state){
  		return state.token
  	}
  },
  mutations: {
			settype(state,payload){
				state.type=payload;
			},
			setcontent(state,payload){
				state.content=payload;
			},
			settitle(state,payload){
				state.title=payload;
			},
			setid(state,payload){
				state.sid=payload;
			},
			setlogin(state,payload){
				state.login=payload;
			},
			settoken(state,payload){
				state.token=payload;
			}
  },
  actions: {
			settype({commit},payload){
				commit('settype',payload);
			},
			setcontent({commit},payload){
				commit('setcontent',payload);
			},
			settitle({commit},payload){
				commit('settitle',payload);
			},
			setid({commit},payload){
				commit('setid',payload);
			},
			setlogin({commit},payload){
				commit('setlogin',payload);
			},
			settoken({commit},payload){
				commit('settoken',payload);
			}
  }
})
